<?php
/**
* Index Controller
*/
class Index extends CI_Controller {
    private $data = array();
	
	public function __construct() {
		parent::__construct();
	}
	
	public function index() {
		// Store totalt items in cart.
		$this->data['cartTotal'] = $this->cart->total_items();
		
		// Set the basetitle for the page.
		$this->data['baseTitle'] = 'Webbshop';
	    
		// Load the products_model and auto-connect to the database.
		$this->load->model('products_model', '', TRUE );
		
		// Get an array of all the products in the database.
		$this->data['products'] = $this->products_model->GetProducts();
		
		// Load the view with the data-array.	    
		$this->load->view( 'index', $this->data );
	} 
}